.SUFFIXES: .f90 .o

MODULE_OBJECTS=\
	param.o derived.o global_param.o\
	output_param.o data_param.o mat_param.o box_param.o\
	group_param.o motion_param.o edit_param.o table_param.o\
	run_param.o label_data_param.o react_data_param.o\
	geom_data_param.o sink_data_param.o profile_map_param.o\
	event_param.o count_param.o

FUNCTION_OBJECTS=\
	reallocExternType.o reallocObjectGroup.o reallocReactGroup.o\
	reallocMotionType.o reallocTempProfile.o reallocObjectType.o\
	str2config.o alloc_groups.o reallocInt.o str2label.o\
	reallocReal.o reallocReactType.o reallocProductType.o\
	reallocExternEventObjectSet.o reallocGeometricObject.o\
	reallocSinkProductType.o reallocSinkReactType.o\
	reallocEventTable.o reallocEventProfile.o\
	reallocSimulatedObject.o

UTIL_ROUTINE_OBJECTS=\
	set_group_type.o str2id.o str2range.o set_point_type.o

IO_ROUTINE_OBJECTS=\
	init_output_param.o init_data_param.o init_box_param.o\
	init_group_param.o init_motion_param.o init_edit_param.o\
	init_table_param.o init_run_param.o init_global_param.o\
	init_mat_param.o init_profile_map.o init_count_param.o\
	readinp.o\
	readlabel.o init_object_type.o\
	readdiff.o readdiss.o\
	readrctn.o init_react_data.o\
	readextn.o\
	readgeom.o init_geom_data.o\
	readsink.o init_sink_data.o\
	readsrce.o\
	read_initial_condition.o

MSG_ROUTINE_OBJECTS=\
	print_head.o\
	log_msg1.o log_msg2.o show_msg1.o show_msg2.o\
	term_msg1.o term_msg2.o print_c_time.o write_head.o\
	write_file_info.o abnormal_stop.o\
	log_msg1_indent.o log_msg2_indent.o\
	drawline.o print_d_time.o

DEBUG_ROUTINE_OBJECTS=\
	check_readinp.o check_readlabel.o check_readrctn.o\
	check_readdiff.o check_readdiss.o check_readextn.o\
	check_readgeom.o check_readsink.o check_readsrce.o\
	check_react_group.o check_react_list.o\
	check_transition_rate.o print_event_profile.o\
	print_event_table.o print_sim_obj.o\
	print_del_event_table.o print_spont_event_table.o\
	print_event.o print_count_obj.o\
	check_count_param.o

MAIN_ROUTINE_OBJECTS=\
	main.o freemem.o set_system_unit.o init_react_group.o\
	set_channel.o set_vbox.o set_mat_param.o init_random_seed.o\
	set_external_event.o init_table.o add_source_event.o\
	alloc_event_table.o alloc_profile_table.o\
	create_object.o boundary_check.o alloc_sim_obj.o\
	set_transition_rate.o update_event_profile.o\
	add_external_event.o remove_object.o move_object.o\
	set_new_pos.o exe_external_event.o set_source_pos.o\
	select_prob_event.o time_loop.o exe_event.o\
	print_object.o loop_loop.o dpa_loop.o\
	print_count_obj_header.o print_exit_msg.o\
	print_start_msg.o print_init_table.o\
	print_profile_msg.o

DATA_FILE=\
	label_data diff_data diss_data react_data

FORM_FILE=\

OBJECTS=$(MODULE_OBJECTS) $(FUNCTION_OBJECTS)\
	$(IO_ROUTINE_OBJECTS) $(MAIN_ROUTINE_OBJECTS)\
	$(MSG_ROUTINE_OBJECTS) $(UTIL_ROUTINE_OBJECTS)\
	$(DEBUG_ROUTINE_OBJECTS)

INPUT=fe.iii

FC=mpif90
OPTION=#-DMPI #-DDEBUG -DPRN_OPTION=1 -DMPI
#FFLAGS=-c -I/usr/local/mpich/include/
FFLAGS=-fpp -DMPI -c -I/usr/local/mpich/include/ #-x f95-cpp-input 
SRCS=$(OBJECTS:.o=.f90)
MODULE=$(MODULE_OBJECTS:.o=.mod)
MF=Makefile
TARGET=pavio

%.o : %.mod

.f90.o:
	$(FC) $(FFLAGS) $(OPTION) $<

$(TARGET): $(OBJECTS)
	$(FC) -o $@ $(OBJECTS)

tar:
	tar cvf $(TARGET).tar $(MF) $(SRCS) 

clean:
	rm $(OBJECTS) $(MODULE) $(TARGET) $(INPUT).*

# module
param.o : param.f90
derived.o : derived.f90
global_param.o : global_param.f90
output_param.o : output_param.f90
data_param.o : data_param.f90
mat_param.o : mat_param.f90
box_param.o : box_param.f90
group_param.o : group_param.f90
motion_param.o : motion_param.f90
edit_param.o : edit_param.f90
table_param.o : table_param.f90
run_param.o : run_param.f90
label_data_param.o : label_data_param.f90
react_data_param.o : react_data_param.f90
geom_data_param.o : geom_data_param.f90
sink_data_param.o : sink_data_param.f90
profile_map_param.o : profile_map_param.f90
event_param.o : event_param.f90
count_param.o : count_param.f90
# function
reallocExternType.o : reallocExternType.f90
reallocObjectGroup.o : reallocObjectGroup.f90
reallocReactGroup.o : reallocReactGroup.f90
reallocMotionType.o : reallocMotionType.f90
reallocTempProfile.o : reallocTempProfile.f90
reallocObjectType.o : reallocObjectType.f90
str2config.o : str2config.f90
alloc_groups.o : alloc_groups.f90
reallocInt.o : reallocInt.f90
str2label.o : str2label.f90
reallocReal.o : reallocReal.f90
reallocReactType.o : reallocReactType.f90
reallocProductType.o : reallocProductType.f90
reallocExternEventObjectSet.o : reallocExternEventObjectSet.f90
reallocGeometricObject.o : reallocGeometricObject.f90
reallocSinkProductType.o : reallocSinkProductType.f90
reallocSinkReactType.o : reallocSinkReactType.f90
reallocEventTable.o : reallocEventTable.f90
reallocEventProfile.o : reallocEventProfile.f90
reallocSimulatedObject.o : reallocSimulatedObject.f90
# utility routine
set_group_type.o : set_group_type.f90
str2id.o : str2id.f90
str2range.o : str2range.f90
set_point_type.o : set_point_type.f90
# main program
main.o : main.f90
freemem.o : freemem.f90
set_system_unit.o : set_system_unit.f90
init_react_group.o : init_react_group.f90
set_channel.o : set_channel.f90
set_vbox.o : set_vbox.f90
set_mat_param.o : set_mat_param.f90
init_random_seed.o : init_random_seed.f90
set_external_event.o : set_external_event.f90
init_table.o : init_table.f90
add_source_event.o : add_source_event.f90
alloc_event_table.o : alloc_event_table.f90
alloc_profile_table.o : alloc_profile_table.f90
create_object.o : create_object.f90
boundary_check.o : boundary_check.f90
alloc_sim_obj.o : alloc_sim_obj.f90
set_transition_rate.o : set_transition_rate.f90
update_event_profile.o : update_event_profile.f90
add_external_event.o : add_external_event.f90
remove_object.o : remove_object.f90
move_object.o : move_object.f90
set_new_pos.o : set_new_pos.f90
exe_external_event.o : exe_external_event.f90
set_source_pos.o : set_source_pos.f90
select_prob_event.o : select_prob_event.f90
time_loop.o : time_loop.f90
exe_event.o : exe_event.f90
print_object.o : print_object.f90
loop_loop.o : loop_loop.f90
dpa_loop.o : dpa_loop.f90
print_exit_msg.o : print_exit_msg.f90
print_start_msg.o : print_start_msg.f90
print_init_table.o : print_init_table.f90
print_profile_msg.o : print_profile_msg.f90
# message routine
print_head.o : print_head.f90
log_msg1.o : log_msg1.f90
log_msg2.o : log_msg2.f90
show_msg2.o : show_msg2.f90
show_msg1.o : show_msg1.f90
term_msg1.o : term_msg1.f90
term_msg2.o : term_msg2.f90
print_c_time.o : print_c_time.f90
write_head.o : write_head.f90
write_file_info.o : write_file_info.f90
abnormal_stop.o : abnormal_stop.f90
log_msg1_indent.o : log_msg1_indent.f90
log_msg2_indent.o : log_msg2_indent.f90
drawline.o : drawline.f90
print_d_time.o : print_d_time.f90
# io routine
init_output_param.o : init_output_param.f90
init_data_param.o : init_data_param.f90
init_box_param.o : init_box_param.f90
init_group_param.o : init_group_param.f90
init_motion_param.o : init_motion_param.f90
init_edit_param.o : init_edit_param.f90
init_table_param.o : init_table_param.f90
init_run_param.o : init_run_param.f90
init_global_param.o : init_global_param.f90
init_mat_param.o : init_mat_param.f90
readinp.o : readinp.f90
readlabel.o : readlabel.f90
init_object_type.o : init_object_type.f90
readdiff.o : readdiff.f90
readdiss.o : readdiss.f90
readrctn.o : readrctn.f90
init_react_data.o : init_react_data.f90
readextn.o : readextn.f90
readgeom.o : readgeom.f90
init_geom_data.o : init_geom_data.f90
readsink.o : readsink.f90
init_sink_data.o : init_sink_data.f90
readsrce.o : readsrce.f90
init_profile_map.o : init_profile_map.f90
init_count_param.o : init_count_param.f90
read_initial_condition.o : read_initial_condition.f90
# debug routine
check_readinp.o : check_readinp.f90
check_readlabel.o : check_readlabel.f90
check_readrctn.o : check_readrctn.f90
check_readdiff.o : check_readdiff.f90
check_readdiss.o : check_readdiss.f90
check_readextn.o : check_readextn.f90
check_readgeom.o : check_readgeom.f90
check_readsink.o : check_readsink.f90
check_readsrce.o : check_readsrce.f90
check_react_group.o : check_react_group.f90
check_react_list.o : check_react_list.f90
check_transition_rate.o : check_transition_rate.f90
print_event_profile.o : print_event_profile.f90
print_event_table.o : print_event_table.f90
print_sim_obj.o : print_sim_obj.f90
print_del_event_table.o : print_del_event_table.f90
print_spont_event_table.o : print_spont_event_table.f90
print_event.o : print_event.f90
print_count_obj.o : print_count_obj.f90
print_count_obj_header.o : print_count_obj_header.f90
check_count_param.o : check_count_param.f90
